package com.zmn.brs.common.enums;

import java.util.Optional;
import java.util.stream.Stream;

/**
 * 类描述：监控周期枚举
 * @author chongw
 * @since 2021/06/11 10:47
 */
public enum MonitorCyclEnum {

    /**
     *
     */
    DAY(1, "每天"),
    MONTH(2, "每月"),
    WEEK(3, "每周");

    /**
     * 类型
     */
    private final Integer typeId;

    /**
     * 类型名
     */
    private final String typeName;

    MonitorCyclEnum(Integer typeId, String typeName) {

        this.typeId = typeId;
        this.typeName = typeName;
    }

    public Integer getTypeId() {

        return typeId;
    }

    public String getTypeName() {

        return typeName;
    }

    public static MonitorCyclEnum getEventTypeEnum(Integer typeId) {

        Optional<MonitorCyclEnum> optional = Stream.of(MonitorCyclEnum.values()).filter(e -> e.getTypeId().equals(typeId)).findFirst();
        return optional.orElse(null);
    }
}
